#include "widget.h"
#include "ui_widget.h"
#include<QDebug>
#include<QKeyEvent>

Widget::Widget(QWidget *parent)
    : QWidget(parent)
    , ui(new Ui::Widget)
{
    ui->setupUi(this);
    timerId = this->startTimer(1000);
}

Widget::~Widget()
{
    delete ui;
}

void Widget::keyPressEvent(QKeyEvent *event){
    qDebug()<< (char)event->key();
}

void Widget::timerEvent(QTimerEvent *e){
    static auto sec = 0;
    sec++;
    ui->label->setText(QString("<center><h1>%1</h1></center>").arg(sec));

    if(sec == 10){
        killTimer(timerId);
    }

}
